<include file="../Public/_header" />
<div class="so_main">
  <!-------- 权限列表 -------->
  <div class="page_tit">权限列表</div>
  <div class="Toolbar_inbox">
  	<div class="page right">{$html}</div>
	<a href="javascript:void(0);" class="btn_a" onclick="setPopedom();"><span>设置权限</span></a>
  </div>
  
  <div class="list">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th style="width:30px;">
		<input type="checkbox" id="checkbox_handle" onclick="checkAll(this)" value="0">
    	<label for="checkbox"></label>
	</th>
    <th class="line_l">节点名</th>
    <th class="line_l">节点别名</th>
    <th class="line_l">用户组</th>
    <th class="line_l">操作</th>
  </tr>
  <volist id="vo" name="data">
	  <tr overstyle='on' id="user_{$vo['node_id']}">
	    <td><input type="checkbox" name="checkbox" id="checkbox2" onclick="checkon(this)" value="{$vo.node_id}"></td>
	    <td>{$vo.app_name} / {$vo.mod_name} / {$vo.act_name}</td>
		<td>{$vo.app_alias} / {$vo.mod_alias} / {$vo.act_alias}</td>
	    <td>
	    	<volist name="node_usergroup[$vo['node_id']]" id="vo2">
	    		{$vo2}<br />
	    	</volist>
	    </td>
	    <td>
			<a href="javascript:void(0)" onclick="setPopedom({$vo.node_id})">设置权限</a> 
		</td>
	  </tr>
  </volist>
  </table>

  </div>
  <div class="list_btm">选择：<a href="javascript:void(0)">全部</a> - <a href="#">反选</a> - <a href="#">不选</a></div>
  <div class="Toolbar_inbox">
	<div class="page right">{$html}</div>
	<a href="javascript:void(0);" class="btn_a" onclick="setPopedom();"><span>设置权限</span></a>
  </div>
</div>

<script>
	//鼠标移动表格效果
	$(document).ready(function(){
		$("tr[overstyle='on']").hover(
		  function () {
		    $(this).addClass("bg_hover");
		  },
		  function () {
		    $(this).removeClass("bg_hover");
		  }
		);
	});
	
	function checkon(o){
		if( o.checked == true ){
			$(o).parents('tr').addClass('bg_on') ;
		}else{
			$(o).parents('tr').removeClass('bg_on') ;
		}
	}
	
	function checkAll(o){
		if( o.checked == true ){
			$('input[name="checkbox"]').attr('checked','true');
			$('tr[overstyle="on"]').addClass("bg_on");
		}else{
			$('input[name="checkbox"]').removeAttr('checked');
			$('tr[overstyle="on"]').removeClass("bg_on");
		}
	}

	//获取已选择的ID数组
	function getChecked() {
		var ids = new Array();
		$.each($('table input:checked'), function(i, n){
			ids.push( $(n).val() );
		});
		return ids;
	}

	//删除节点
	function setPopedom(ids) {
		ids = ids ? ids : getChecked();
		ids = ids.toString();
		if(ids == '') {
			ui.error('请先选择节点');
			return false;
		}
		if(!confirm('设置成功后将无法恢复，确认继续？')) return false;
		
		ui.box.load("{:U('admin/User/setPopedom')}&nids="+ids, {title:'设置权限'});
	}
	
	//搜索用户
	var isSearchHidden = <neq name="type" value="searchUser">1<else/>0</neq>;
	function searchUser() {
		if(isSearchHidden == 1) {
			$("#searchUser_div").slideDown("fast");
			$(".searchUser_action").html("搜索完毕");
			isSearchHidden = 0;
		}else {
			$("#searchUser_div").slideUp("fast");
			$(".searchUser_action").html("搜索用户");
			isSearchHidden = 1;
		}
	}
</script>

<include file="../Public/_footer" />